import { createRouter, createWebHistory } from 'vue-router'
import Home from '../views/Home.vue'

const routes = [
  {
    path: '/',
    redirect: '/login'
  },
  {
    path: '/Home',
    name: 'Home',
    component: Home
  },
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/loginRegister.vue')
  },
  {
    path: '/about',
    name: 'About',
    // which is lazy-loaded when the route is visited.
    component: () => import(/* webpackChunkName: "about" */ '../views/About.vue')
  },
  {
    path:'/info',
    name:'info',
    component:()=> import('../views/info.vue')
  },
  {
    path:'/swiper',
    name:'swiper',
    component:()=> import('../views/swiper.vue')
  },
  {
    path:'/loading',
    name:'loading',
    component:()=> import('../components/loading.vue')
  },
  {
    path:'/:catchall(.*)',//正则匹配失败的页面为404
    name:'404',
    component:()=> import('../views/404.vue')
  }
]

const router = createRouter({
  history: createWebHistory(process.env.BASE_URL),
  routes
})

export default router
